# #coding=utf-8
# def jump(n):
# 	if n<=3:
# 		return n
# 	a,b=2,3
# 	for i in range(4,n+1):
# 		a,b = b,a+b
# 	return b

# def jump_d(n):
# 	dp = [0 for _ in range(n+1)]
# 	dp[0] = 1
# 	dp[1] = 1
# 	dp[2] = 2
# 	for i in range(3,n+1):
# 		dp[i] = dp[i-1] + dp[i-2]
# 	return dp[n]


# # print(jump_d(40))
# def lcs(x, y):
# 	m = len(x)
# 	n = len(y)
# 	c = [[0 for _ in range(m+1)] for _ in range(n+1)]
# 	for i in range(1,n+1):
# 		for j in range(1,m+1):
# 			if x[j-1] == y[i-1]:
# 				c[i][j] = c[i-1][j-1] + 1
# 			else:
# 				c[i][j] = max(c[i-1][j],c[i][j-1])
# 	return c[n][m]

# print(lcs('bl','yby'))


# def lcs(x,y):
# 	m = len(x)
# 	n = len(y)
# 	c = [[0 for _ in range(n+1)] for _ in range(m+1)]
# 	for i in range(1,n+1):
# 		for j in range(1,m+1):
# 			if x[j-1] == y[i-1]:
# 				c[j][i] = c[j-1][i-1] + 1
# 			else:
# 				c[j][i] = max(c[j-1][i],c[j][i-1])
# 	return c[m][n]

# print(lcs('bl','yby'))


def insert_sort(li):
    n = len(li)
    for i in range(n - 1):
        tmp = li[i + 1]
        while i >= 0 and li[i] > tmp:
            li[i + 1] = li[i]  # 右移
            i -= 1
        li[i + 1] = tmp
    return li


def merge(li, low, mid, high):
    ltmp = []
    i = low
    j = mid + 1
    while i <= mid and j <= high:
        if li[i] < li[j]:
            ltmp.append(li[i])
            i += 1
        else:
            ltmp.append(li[j])
            j += 1
    if i <= mid:
        ltmp.extend(li[i:mid + 1])
    else:
        ltmp.extend(li[j:high + 1])
    li[low:high + 1] = ltmp


def merge_sort(li, low, high):
    if low < high:
        mid = (low + high) // 2
        merge_sort(li, low, mid)
        merge_sort(li, mid + 1, high)
        merge(li, low, mid, high)


def sift(li, low, high):
    i = low
    j = 2 * i + 1
    tmp = li[i]
    while j <= high:
        if j + 1 <= high and li[j] < li[j + 1]:
            j += 1
        if tmp < li[j]:
            li[i] = li[j]
            i = j
            j = 2 * i + 1
        else:
            break
    li[i] = tmp


def heap_sort(li):
    n = len(li)
    for i in range((n - 2) // 2, -1, -1):
        sift(li, i, n - 1)
    for i in range(n - 1, -1, -1):
        li[0], li[i] = li[i], li[0]
        sift(li, 0, i - 1)


# import random
# li = list(range(100))
# random.shuffle(li)
# heap_sort(li)
# print(li)

# import requests
# import json

# url = "https://spapi.baidu.com/oauth/jscode2sessionkey"
# headers = {
# 	'Content-Type' : "Application/x-www-form-urlencoded"
# }
# req = requests.get(url,headers=headers)#
# print(req.json())#


# li = [{'刘意希': 3.0}, {'牛超': 3.0}, {'郭钧豪': 3.0}, {'李佳': 3.0}, {'毛君玉': 3.0}, {'吴凯兴': 3.0}, {'苟瑞晗': 3.0}, {'蔡世建': 3.0}, {'梁爽': 3.0}, {' 岳禹成': 3.0}, {'孙少辉': 3.0}, {'田苑': 3.0}, {'宋建敏': 3.0}, {'仵娟': 3.0}, {'田莲': 3.0}, {'孙敏': 3.0}, {'李华': 3.0}, {'王俊朋': 3.0}, {'刘明月': 3.0}, {'张明杰': 3.0}, {'刘意希': 2.0}, {'牛超': 2.0}, {'郭钧豪': 2.0}, {'李佳': 2.0}, {'毛君玉': 2.0}, {'吴凯兴': 2.0}, {'苟瑞晗': 2.0}, {'蔡世建': 2.0}, {'梁爽': 2.0}, {' 岳禹成': 2.0}, {'孙少辉': 2.0}, {'田苑': 2.0}, {'宋建敏': 2.0}, {'仵娟': 2.0}, {'田莲': 2.0}, {'孙敏': 2.0}, {'李华': 2.0}, {'王俊朋': 2.0}, {'刘明月': 2.0}, {'张明杰': 2.0}, {'刘意希': 1.0}, {'牛超': 1.0}, {'郭钧豪': 1.0}, {'李佳': 1.0}, {'毛君玉': 1.0}, {'吴凯兴': 1.0}, {'苟瑞晗': 1.0}, {'蔡世建': 1.0}, {'梁爽': 1.0}, {' 岳禹成': 1.0}, {'孙少辉': 1.0}, {'田苑': 1.0}, {'宋建敏': 1.0}, {'仵娟': 1.0}, {'田莲': 1.0}, {'孙敏': 1.0}, {'李华': 1.0}, {'王俊朋': 1.0}, {'刘明月': 1.0}, {'张明杰': 1.0}, {'刘意希': 4.0}, {'牛超': 4.0}, {'郭钧豪': 4.0}, {'李佳': 4.0}, {'毛君玉': 4.0}, {'吴凯兴': 4.0}, {'苟瑞晗': 4.0}, {'蔡世建': 4.0}, {'梁爽': 4.0}, {' 岳禹成': 4.0}, {'孙少辉': 4.0}, {'田苑': 4.0}, {'宋建敏': 4.0}, {'仵娟': 4.0}, {'田莲': 4.0}, {'孙敏': 4.0}, {'李华': 4.0}, {'王俊朋': 4.0}, {'刘明月': 4.0}, {'张明杰': 4.0}]
# adict = {}
# for l in li:
# 	for i in l.items():
# 		key = '{}:{}'.format(i[0],i[1])
# 		if adict.get(key):
# 			adict[key] = adict.get(key) + 1
# 		else:
# 			adict[key] = 1
# print(adict)


# import xlrd
# import xlwt

# # 打开文件
# workbook = xlrd.open_workbook('./qing.xlsx')
# sheet1 = workbook.sheet_by_index(0)

# # 获取对应列的数据
# scores = sheet1.col_values(0)[1:]
# names = sheet1.col_values(1)[1:]

# # 利用dict统计次数,以name:value为key,次数value:[0,0,0,0]分别对应1/2/3/4级bug
# adict = {}
# flag_dict = {  # bug等级与value下标的映射关系
# 	1:0, 2:1, 3:2, 4:3
# }
# len_scores = len(scores)
# for index in range(len_scores):
# 	if names[index]: # 过滤掉name为空的数据
# 		key = names[index]
# 		if adict.get(key):
# 			value = adict[key]  # 存在则通过name取value
# 			value[flag_dict[scores[index]]] += 1  # 通过flag_dict路由表找到对应的下标并将下标对应的value+1
# 		else:
# 	   		value = [0,0,0,0]  # 初始化score,分别对应1/2/3/4级bug
# 	   		value[flag_dict[scores[index]]] += 1  # 通过flag_dict路由表找到对应的下标并将下标对应的value赋值
# 		adict[key] = value   # 将新的value赋值给name
# 	index += 1

# # 写入数据到新文件
# new_file_name = 'name_score_count.xls' # 定义文件名
# w = xlwt.Workbook()
# ws = w.add_sheet('name_score_count')  # 定义sheet
# title = ['name', 'bug总数', '1级bug', '2级bug', '3级bug', '4级bug'] # 定义title
# cell, row = 0, 1
# for i in title:  # 将title写入
# 	ws.write(0,cell,i)
# 	cell += 1
# for i in adict.items():  # 循环写入name/count/score
# 	ws.write(row,0,i[0])
# 	ws.write(row,1,sum(i[1])) # sum求出总bug
# 	ws.write(row,2,i[1][0])
# 	ws.write(row,3,i[1][1])
# 	ws.write(row,4,i[1][2])
# 	ws.write(row,5,i[1][3])
# 	row += 1
# w.save(new_file_name)  # 保存文件


# import requests

# url = "http://test-robotaxi.baidu.com/operation/api/appconfig/carmodel_pic/"
# headers = {
# 	"Content-Type": "application/json",
# 	"Authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjp7InVzZXJfaWQiOjkxNTEsInVzZXJfbmFtZSI6Inpob3VoYW84Nzg5IiwicGFzc3BvcnRfdXNlcl9pZCI6IjY2NzQyMTE5IiwicGFzc3BvcnRfdXNlcl9uYW1lIjoiemhvdWhhbzg3ODkifSwiZXhwIjoxNjA5NDY4MjcyLCJuYmYiOjE2MDY4NzYyNzJ9.6FJ3PFu7f2C4PyeUb-Wgz54xvgAqfFyZq-NFfniTKDQ"

# }

# r = requests.get(url,headers=headers)
# print(r.text)


# 数字加字符反转当字符下标不变
# def reveser(s):
# 	str1, str2 = [], []
# 	for index,i in enumerate(s):
# 		try:
# 			str1.insert(0,str(int(i)))
# 		except:
# 			str2.append([index,i])
# 	for i in str2:
# 		str1.insert(i[0],i[1])
# 	return ''.join(str1)


# print(reveser('137&12^'))


# from fastapi import FastAPI

# app = FastAPI()


# @app.get("/")
# def read_root():
#     return {"我的第一个FastAPI": "Hello World!"}


# @app.get("/test/{use_id}")
# def read_item(use_id: int, key: str = None):
#     return {"use_id": use_id, "key": key}

# import uvicorn
# uvicorn.run(app, host='127.0.0.1', port=8001)


# import pymysql
# from datetime import datetime, timedelta
# import xlwt
# host = 'smartbns.adurobotaxi-bmi0000.xdb.all.serv'
# port = 6131
# user = 'fleet_carway'
# password = 'Fleet_Eagle1'
# database = 'login_center'
# db = pymysql.connect(host=host, port=port, user=user, password=password, database=database)
# #使用cursor()方法创建一个游标对象
# cursor = db.cursor()
# now = datetime.now()
# start_time = datetime.strftime((now - timedelta(days=now.weekday() + 7)),'%Y-%m-%d')
# end_time = datetime.strftime((now - timedelta(days=now.weekday())),'%Y-%m-%d')
# print(start_time, end_time)
# #使用execute()方法执行SQL语句
# cursor.execute(f"SELECT last_name,mobile,age,email, create_time FROM users where register_type=10 and create_time >= {start_time} and create_time < {end_time};")


# #使用fetall()获取全部数据
# data = cursor.fetchall()

# #打印获取到的数据
# print('数据:',data)

# #关闭游标和数据库的连接
# cursor.close()
# db.close()

# # 写入数据到新文件
# new_file_name = 'user_phone.xls' # 定义文件名
# w = xlwt.Workbook()
# ws = w.add_sheet('user_phone')  # 定义sheet
# title = ['姓名', '手机号', '年龄', '邮箱', '创建时间'] # 定义title
# cell, row = 0, 1
# for i in title:  # 将title写入
# 	ws.write(0,cell,i)
# 	cell += 1
# for i in data:  # 循环写入name/count/score
# 	print(i,type(i), '*'*80)
# 	ws.write(row,0,i[0])
# 	ws.write(row,1,i[1]) # sum求出总bug
# 	ws.write(row,2,i[2])
# 	ws.write(row,3,i[3])
# 	ws.write(row,3,i[4])
# 	row += 1
# w.save(new_file_name)  # 保存文件
# print('生成文件成功'


# file_name = ['', '北京', '北京市_center.png', '北京市_order_MKZ_red.png', '北京_order_MKZ_red.png']


# def convert_file_name(i):
#     if i.find('市') == -1:
#         alist = i.split('_')
#         alist[0] += '市'
#         i = '_'.join(alist)
#     return i.lower()


# import requests
#
# res = requests.post(url='http://yq01-adu-f02xi3-11.yq01.baidu.com:8080/cancel_task', headers={'Content-Type': 'application/json'})
# print(res)



# li = [{'a':1,'b':88},{'a':2,'b':99},{'a':1,'b':102}]
# ret = {}
# for i in li:
#     if ret.get(i['a']):
#         ret[i['a']] = ret[i['a']]+[i['b']]
#     else:
#         ret[i['a']] = [i['b']]
# print(ret)


# class Node:
#     def __init__(self, data, next=None, pre=None):
#         self.data = data
#         self.next = next
#         self.pre = pre

# head = Node('1')
# b = Node('2')
# c = Node('3')
# head.next = b 
# b.next = c


# def reverse_node(head):
#     NewList = None
#     while head:
#         tmp = head.next
#         head.next = NewList
#         NewList = head
#         head = tmp
#     return NewList


